﻿Public Class ParameterForm
    Public ReadOnly Property DateFrom() As Date?
        Get
            Return dtFrom.DateTime.Date
        End Get
    End Property

    Public ReadOnly Property DateTo As Date?
        Get
            Return dtTo.DateTime.Date.AddDays(1)
        End Get
    End Property


    Private Sub btnOK_Click(sender As System.Object, e As System.EventArgs) Handles btnOK.Click
        If ValidateDate() Then
            DialogResult = Windows.Forms.DialogResult.OK
        Else
            MessageWindow.ShowMessage("Please validate your dates.")
            DialogResult = Windows.Forms.DialogResult.None
        End If
    End Sub

    Private Function ValidateDate() As Boolean
        'If Not DateFrom.Then Then
        '    Return False
        'ElseIf Not DateTo.HasValue Then
        '    Return False
        'Else

        If DateTo.Value < DateFrom.Value Then
            Return False
        Else
            Return True
        End If
    End Function

End Class